<?php session_start();
include "constants.php";

$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); 

if (!$link) { 
    die('Could not connect: ' . mysql_error()); 
} 
mysql_select_db(DB_NAME);

$sql = "SELECT * FROM HOURS";
$result = mysql_query($sql,$link);  	
$row = mysql_fetch_array($result);
$START=$row['START'];
$CLOSE=$row['CLOSE'];

$sql = "SELECT * FROM HOLIDAYS WHERE Datediff(NOW( ) , STR_TO_DATE(DATES , '%m/%d/%Y' ) )=0";
$result = mysql_query($sql,$link);  	
$row = mysql_fetch_array($result);
$NAMES=$row['NAMES'];
$DATES=$row['DATES'];
$HOLIDAYS=mysql_num_rows($result);


$provinceID=null;//declare variables

mysql_select_db(cash2uca); 

if(isset($_POST["provinceID"]) && is_numeric($_POST["provinceID"]))
{
    $provinceID = $_POST["provinceID"];
	$sql = "SELECT * FROM ProvinceRates WHERE PID= $provinceID";
        $pcost = mysql_query($sql,$link);  	
	$row = mysql_fetch_array($pcost);
	$PROV=$row['Province'];
	$MCOST=$row['Rates'];
//Coupon
	$Re=mysql_query("SELECT Rate FROM `Promotion` WHERE PID = 1",$link);
	$row = mysql_fetch_array($Re);
	$_SESSION['result'] = $row['Rate'];


//	if($_POST["provinceID"]==8) {$ontario="in Ontario";} else {$ontario="";}
	if($_POST["provinceID"]==8) {$ontario="";} else {$ontario="";}
//requested to change by GOV
}

$COUPON=$MCOST*(1-$_SESSION['result']);
$COUPONCOST=3*$COUPON;
$Total=300+(3*$MCOST)-$COUPONCOST;
$PerC=(1-$_SESSION['result'])*100;
$Discount=$PerC."%";

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"-->
<head>
<!-- Update your html tag to include the itemscope and itemtype attributes -->
<html itemscope itemtype="http://schema.org/LocalBusiness">
<meta name="msvalidate.01" content="4C654866FA74E330E17E40ABBBDBE7BD" />
<!-- Add the following three tags inside head -->
<meta itemprop="name" content="Payday loan and cash advance online provider in Canada">
<meta itemprop="description" content="payday loan and cash advance online application">
<meta itemprop="image" content="www.cash2u.ca/apply.php">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Cash2u.ca: Please choose your province you are living in to apply for your payday loan</title>
<META NAME="Keywords" CONTENT="How it works, payday loans,cash advance, payday loan, pay day loans, payday cash advance, online, unsecured loans, no fax payday loans, payday advance, payday cash loan, payday loans, cash advance, paycheque loans, short term,fast cash, unsecured personal loans, pay day loan, no fax loans, no faxing payday loans, no fax cash advance, faxless payday loans, short term loans, unsecured personal loan, unsecured loan, online loans, quick cash, no fax payday loan, payday cash advance, cash advance, online loan, fast cash loans, signature loan, no fax pay day loans, pay day advance, payday loans no faxing required, payday loan online, no faxing cash advance, payday loans no faxing, canada, money mart, money here, quick cash,check,cashing,easy,tax, bill,payment,currency,card,credit,Easy Cash Advances,Internet Payday loans, Payroll Advance, Payday Loan Services,Online Payday Advances, Online Payday Loan Provider, Pay Day">
<META NAME="Description" CONTENT=Cash2u.ca offers online payday loans and cash advance for Canadians">

<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/main_style.css"/>
<link rel="stylesheet" type="text/css" href="../css/index.css"/>
<script type="text/javascript">
function autoSubmit()
{
    var formObject = document.forms['myfishes'];
    formObject.submit();
}

</script>
</head>
<body>
<div id="maincontainer">

<div id="headsection">
<div id="headback">
<br/><br/><br/><h1><a style="color:white;" href="apply.php">Cash to you</a></h1><p id="headpara"><a style="color:white;" href="apply.php">Simple Easy Fast - Your payday loan</a></p>
</div>
</div>

<table cellspacing="4" cellpadding="1" border="0" style="margin:5px;height:50px;width:740px;background-color:#084c8d;border:1px solid #e5e5e5;color:white;font-size:110%;font-weight:bold;">
<tr><td width="20"></td>
<td width="90" align="center"><a class="headlink" href="index.html">HOME</a></td>
<td width="90" align="center"><a class="headlink" href="apply.php">APPLY</a></td>
<td width="130" align="center"><a class="headlink" href="member.php"><span class="displace">MEMBERS</span></a></td>
<td width="110" align="center"><a class="headlink" href="career.php"><span class="displace">CAREER</span></a></td>
<td width="90" align="center"><a class="headlink" href="faqs.php"><span class="displace">FAQ's</span></a></td>
<td width="90" align="center"><a class="headlink" href="contact.php"><span class="displace">CONTACT</span></a></td>
<td width="140"></td>
</tr>
</table>

<div id="content">

<form name="myfishes" method="post"> 
<!--p id="residence">Our office will be closed on February 16, 17 and 18, 2013 due to Family Day</p-->
<!--p id="residence">Your application will be approved on February 19, 2013</p-->
<p align="center" style="color:blue;">Office Hours: Monday to Friday (except weekends and holidays) <?php echo $START." ~ ".$CLOSE;?></p>
<p align="center" style="color:blue;"><?php if($HOLIDAYS!=0) {echo "Today our office is closed on holiday--".$NAMES;};?></p>


<p id="residence">Please choose your province</p>
<p id="residence">
<select id="province" name="provinceID" onChange="autoSubmit();">		     
        <option value="null">Please select province</option>
        <?php        
        //POPULATE Current Coupon Rate from Database
        $sql = "SELECT * FROM ProvinceRates ORDER BY Province";
        $pcost = mysql_query($sql,$link);  	
	while($row = mysql_fetch_array($pcost)) {        
            echo ("<option value=\"$row[PID]\" " . ($provinceID == $row["PID"] ? " selected" : "") . ">$row[Province]			</option>");  }  ?>
</select></p>
</form>

<form name="fishes" id="fishes" action="applysecond.php" method="post"> 
<?php if($provinceID != null && is_numeric($provinceID))  { ?>
<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;">
<tr><td width="700" align="center">
	<div class="outers">
	<table cellspacing="4" cellpadding="1" border="0" style="margin:5px;height:50px;width:700px;">
	<!--p>Payday Loan License Number: 4723756 -- Expiry Date: September 03, 2014</br></p-->
	<img style="margin:5px;height:250px;width:600px;" src="../images/paydayphoto.JPG"/>	
	</table>

	</div>

<h2 style='color:blue'><a style="color:black" href="posterinformation.php" target="_blank">How much will your loan cost you(image here)?</a></h2>
    <div class="outers">
	
	<?php if (!($_SESSION['result']<1.0)) {
        echo "<!--h2 style='color:blue'>How much will your loan cost you?</h2-->
	<h3>Maximum Allowable Cost ".$ontario." per $100 Borrowed: </h3>
	<p>$".$MCOST.".00</p>
	<h3>Our cost per $100 borrowed: </h3>
	<p>$".$MCOST."</p>
	<h4><span style='color:blue'>Example</span>:Your $300 loan for 14 days: </h4>
	<p>Amount Advanced $300.00<br/>
	Total cost of borrowing $".(3*$MCOST)." <!--(= 3*$".$MCOST.")--></p>	
	<p width=500 align=center>---------------------------------------------------------------------------<p/>
	<p>Total You Repay $".(300+3*$MCOST)." <!--(= $300+$".(3*$MCOST).")--><br/></p>";}

	else {echo "<h2 style='color:blue'>How much will your loan cost you?</h2>
	<p>The Maximum Allowable Cost ".$ontario." per $100 Borrowed: <span style='color:blue'>$".$MCOST."</span></p>
	<p>Our cost for $100 borrowed is <span style='color:blue'>$". ($MCOST-$COUPON) ."</span> (=$".$MCOST."-<span 	style='color:blue'>".$Discount." off your cost</span>)</p>
			
	<p><span style='color:blue'>Example</span>: For a $300 loan for 14 days: <br/>
	Total cost of borrowing = $".((3*$MCOST)-$COUPONCOST)." <!--(=3 x $".($MCOST-$COUPON).")--><br/>
	Total your repay = $". $Total." <!--(=$300 + $".((3*$MCOST)-$COUPONCOST).")(save <span 	style='color:blue'>$".$COUPONCOST."</span>)--></p>";}
	?>
	
	<!--p>Payday Loan License Number: 4723756 </br>Expiry Date: October 05, 2012</br></p-->

    </div></td></tr>
	<tr><td width="700" align="center">
        <div class="inners">
        <p style="line-height: 120%;">This information is required under the Payday Loans Act, 2008.
		 <!--For full information on the Payday Loans Act, 2008 including the Ontario Payday Lending Education Fund, visit the 		Consumer Protection Branch website at http://www.sbe.gov.on.ca. Or to contact by regular mail:<br/>
                                                            Registrar, Payday Loans Act, 2008<br/>
                                                            Consumer Protection Branch<br/>
                                                            5775 Yonge Street, Suite 1500<br/>
                                                            Toronto, ON M7A 2E5-->
                                                         </p>
                                                      </div></td></tr>
<tr><td width="700" align="center">                                                 
        <p><input type="submit" value="Next"></p>
              
</td></tr>
<td></tr><input type="text" name="province" style="visibility:hidden;" value="<?php echo $PROV;?>"></td></tr></table>

    <?php    }    ?>



	</form>
</div>
</br>
</br>
<div><img src="../images/security.gif"/></div>

<div id="footer">
<div id="imlinks"><b><strong>Copyright &#169 2011 Cash2u.ca All rights reserved</strong></b></div>
</div>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone annotation="inline"></g:plusone>

<!-- Place this render call where appropriate -->
<script type="text/javascript">
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>
<div style="visibility:hidden;"><h1>Payday Loan, Payday Loan, Payday Loan and Your Payday Loan</h1></div>
</div>

</body>
</html>
































































































































